//
//  WithDrawlRecordTableViewCell.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/6.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "WithDrawlRecordTableViewCell.h"

@interface WithDrawlRecordTableViewCell ()
{
    GLGWLabel *tipsLabl;
    GLGWImageView *tipImgV;
}
@end

@implementation WithDrawlRecordTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.backgroundColor = [UIColor whiteColor];
        GLGWView *baView = [[GLGWView alloc] initWithInSuperView:self];
        [baView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(@(kHeightProportion_In_iPhoneTriploid(15)));
            make.left.equalTo(self).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.right.equalTo(self).offset(-kWidthProportion_In_iPhoneTriploid(15));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(123)));
        }];
        [baView setViewShadowWidth:6 theCornerRadius:6];
        baView.backgroundColor = [UIColor whiteColor];
        
        GLGWLabel *cardNumLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:kColor_Rule_Black inSuperView:baView];
        cardNumLab.text = @"622202020005611";
        [cardNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(baView).offset(-kWidthProportion_In_iPhoneTriploid(52));
            make.left.equalTo(baView).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.top.equalTo(baView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(10));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(30)));
        }];
        
        GLGWLabel *bankNameLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#666666"] inSuperView:baView];
        bankNameLab.text = @"招商银行";
        [bankNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(cardNumLab.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(8));
            make.right.equalTo(baView.mas_right);
            make.left.equalTo(cardNumLab.mas_left);
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        
        GLGWLabel *waterListNumLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:baView];
        waterListNumLab.text = @"TX0014235411";
        [waterListNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(bankNameLab.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(5));
            make.right.equalTo(baView.mas_right);
            make.left.equalTo(cardNumLab.mas_left);
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        
        GLGWLabel *moneyLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(16) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:baView];
        NSString *str = @"¥3030";
        moneyLab.attributedText = [GLGWLabel bllChangeStr:str changewithStr:@"¥" changeColoer:[UIColor colorWithHexString:@"#EC5353"] withFont:SYSTEMFONT(12)];
        [moneyLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(baView.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(14));
            make.bottom.equalTo(baView.mas_bottom).offset(-kHeightProportion_In_iPhoneTriploid(12));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(22)));
        }];
        
        GLGWLabel *timeLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#999999"] inSuperView:baView];
        timeLab.text = @"2018-08-21 12:12:12";
        [timeLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.lessThanOrEqualTo(moneyLab.mas_left).offset(-kWidthProportion_In_iPhoneTriploid(5));
            make.top.equalTo(waterListNumLab.mas_bottom).offset(kHeightProportion_In_iPhoneTriploid(6));
            make.left.equalTo(cardNumLab.mas_left);
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(17)));
        }];
        
        GLGWLabel *tipLab = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#FFFFFF"] inSuperView:self];
        tipLab.text = @"已提现";
        [tipLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(12));
            make.top.equalTo(baView.mas_top).offset(kHeightProportion_In_iPhoneTriploid(15));
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(54)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(18)));
        }];
        tipLab.backgroundColor = [UIColor colorWithHexString:@"#A89A60"];
        tipLab.textAlignment = NSTextAlignmentCenter;
        tipsLabl = tipLab;
        
        GLGWImageView *imgV = [[GLGWImageView alloc] initWithImageName:@"ToAudit" inSuperView:self];
        [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(tipLab.mas_bottom);
            make.left.equalTo(baView.mas_right);
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(3)));
            make.height.equalTo(@(kHeightProportion_In_iPhoneTriploid(1)));
        }];
        tipImgV = imgV;

    }
    return self;
}

- (void)setWithDrawRecordType:(WithDrawRecordType)withDrawRecordType
{
    _withDrawRecordType = withDrawRecordType;
    if (withDrawRecordType == WithDrawRecordType_ToAudit) {
        tipImgV.image = [UIImage imageNamed:@"ToAudit"];
        tipsLabl.text = @"待审核";
        tipsLabl.backgroundColor = [UIColor colorWithHexString:@"#E3AF1B"];
    } else if (withDrawRecordType == WithDrawRecordType_HaveWithdrawal) {
        tipImgV.image = [UIImage imageNamed:@"HaveWithdrawal"];
        tipsLabl.text = @"已提现";
        tipsLabl.backgroundColor = [UIColor colorWithHexString:@"#A89A60"];
    } else if (withDrawRecordType == WithDrawRecordType_ForWithdrawal) {
        tipImgV.image = [UIImage imageNamed:@"ForWithdrawal"];
        tipsLabl.text = @"待提现";
        tipsLabl.backgroundColor = [UIColor colorWithHexString:@"#5DC061"];
    } else if (withDrawRecordType == WithDrawRecordType_AuditFailure) {
        tipImgV.image = [UIImage imageNamed:@"AuditFailure"];
        tipsLabl.text = @"审核失败";
        tipsLabl.backgroundColor = [UIColor colorWithHexString:@"#EC5353"];
    }
}

- (void)setType:(MyInvoiceType)type
{
    _type = type;
    if (type == MyInvoiceType_WaitingFor) {
        tipImgV.image = [UIImage imageNamed:@"AuditFailure"];
        tipsLabl.text = @"代开票";
        tipsLabl.backgroundColor = [UIColor colorWithHexString:@"#EC5353"];
    } else if (type == MyInvoiceType_Haved) {
        tipImgV.image = [UIImage imageNamed:@"HaveWithdrawal"];
        tipsLabl.text = @"已开票";
        tipsLabl.backgroundColor = [UIColor colorWithHexString:@"#A89A60"];
    }
}

@end
